﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Infratructure.RepositoryWay
{
    public interface IRepository <T>
    {
        /// <summary>
        /// 查询某条数据
        /// </summary>
        /// <param name="id">主键</param>
        /// <returns>数据</returns>
        Task<T?> GetByIdAsync(long id);
        /// <summary>
        /// 添加某条数据
        /// </summary>
        /// <param name="id">主键</param>
        /// <returns>影响行数</returns>

        Task<int> AddAsync(T t);
        /// <summary>
        /// 修改某条数据
        /// </summary>
        /// <param name="t">修改后的数据</param>
        /// <returns>影响行数</returns>
        Task<int> UpdateAsync(T t);
        /// <summary>
        /// 删除某条数据
        /// </summary>
        /// <param name="id">主键</param>
        /// <returns>影响行数</returns>
        Task<int> DeleteAsync(long id);
        /// <summary>
        /// 获取列表数据
        /// </summary>
        /// <returns></returns>
        ISugarQueryable<T> GetAll();

    }
}
